
import { getInfo, setInfo } from "@/utils/storage"
export default {
    namespaced: true,
    // 提供数据
    state() {
        return {
            userInfo: getInfo()
        }
    },
    mutations: {
        setUserInfo(state, obj) {
            state.userInfo = obj
            setInfo(obj)
        }
    },
    actions: {
        logout(context) {
            context.commit("setUserInfo", {});
            context.commit("cart/setCarList", [], { root: true });
        },
    },
}